/*
 * @Author: chengsl
 * @Date: 2022-11-15 15:11:27
 * @LastEditors: chengsl
 * @LastEditTime: 2022-11-15 15:11:35
 * @Description: file content
 */

// 深拷贝
export const deepCopy = function(obj) {
  if (obj == null) { return null }
  var result = Array.isArray(obj) ? [] : {}
  for (const key in obj) {
    // eslint-disable-next-line no-prototype-builtins
    if (obj.hasOwnProperty(key)) {
      if (typeof obj[key] === 'object') {
        result[key] = deepCopy(obj[key]) // 如果是对象，再次调用该方法自身
      } else {
        result[key] = obj[key]
      }
    }
  }
  return result
}
